const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})
const db = cloud.database();
const dayjs = require('dayjs');
const ResponseDTO = require('./res');
// 情侣关系表
const COUPLE = 'cloud_couples'; 
const USER = 'edu-cloud-users';

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  let userId = event.userId || wxContext.OPENID;
  db.collection(COUPLE).where({
    userId
  }).remove();
  db.collection(COUPLE).where({
    coupleId:userId
  }).remove();
  return ResponseDTO.succMsg("解除绑定!");
}